package domain

type FieldInfo struct {
	Struct      *StructInfo `json:"-"`
	LineNO      int
	Name        string
	DataType    string
	Annotations []*AnnotationInfo
}

func NewFieldInfo() *FieldInfo {
	it := new(FieldInfo)
	it.Annotations = []*AnnotationInfo{}
	return it
}

func (me *FieldInfo) AppendAnnotation(ant *AnnotationInfo) {
	me.Annotations = append(me.Annotations, ant)
}

func (me *FieldInfo) Clone() interface{} {
	it := new(FieldInfo)
	it.Struct = me.Struct
	it.LineNO = me.LineNO
	it.Name = me.Name
	it.DataType = me.DataType

	it.Annotations = make([]*AnnotationInfo, len(me.Annotations))
	for i, v := range me.Annotations {
		it.Annotations[i] = v.Clone().(*AnnotationInfo)
	}

	return it
}
